import request from '@/config/axios'

// 货币汇率 VO
export interface ExchangeRateVO {
  id: number // 货币ID
  currencyName: string // 货币简称
  currencyCode: string // 货币编码
  currencySymbol: string // 货币符号
  exchangeRate: number // 汇率（货币1:US）
  areaCode: string // 地区编码
  areaName: string // 地区简称
  currencySort: number // 显示顺序
  status: number // 状态（0正常 1停用）
  remark: string // 备注
}

// 货币汇率 API
export const ExchangeRateApi = {
  // 查询货币汇率分页
  getExchangeRatePage: async (params: any) => {
    return await request.get({ url: `/currency/exchange-rate/page`, params })
  },

  // 查询货币汇率详情
  getExchangeRate: async (id: number) => {
    return await request.get({ url: `/currency/exchange-rate/get?id=` + id })
  },

  // 新增货币汇率
  createExchangeRate: async (data: ExchangeRateVO) => {
    return await request.post({ url: `/currency/exchange-rate/create`, data })
  },

  // 修改货币汇率
  updateExchangeRate: async (data: ExchangeRateVO) => {
    return await request.put({ url: `/currency/exchange-rate/update`, data })
  },

  // 删除货币汇率
  deleteExchangeRate: async (id: number) => {
    return await request.delete({ url: `/currency/exchange-rate/delete?id=` + id })
  },

  // 导出货币汇率 Excel
  exportExchangeRate: async (params) => {
    return await request.download({ url: `/currency/exchange-rate/export-excel`, params })
  },
}